package com.dkm.orproject.dkmoa.service.serviceimpl.flow;

import com.dkm.orproject.dkmoa.dao.OaEmergencyContactMapper;
import com.dkm.orproject.dkmoa.domain.OaEmergencyContact;
import com.dkm.orproject.dkmoa.service.flow.OaEmergencyContactService;
import com.dkm.orproject.utils.utils.IdToobtainUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.List;

/**
 * @PROJECT_NAME: orproject
 * @DESCRIPTION:
 * @USER: 周骡子
 * @DATE: 2020/8/12 15:16
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class OaEmergencyContactServiceimpl implements OaEmergencyContactService {
    @Autowired
    OaEmergencyContactMapper oaEmergencyContactMapper;
    @Resource
    IdToobtainUtils utils;
    /**
     * 紧急联络人增加语句
     * @param record 对象
     * @return 返回行数
     */
    @Override
    public int insertSelective(OaEmergencyContact record) {
        record.setEmergencyContactId(utils.getNumberId());
        return oaEmergencyContactMapper.insertSelective(record);
    }

    /**
     * 根据主键查询
     * @param emergencyContactId 主键
     * @return 返回对象
     */
    @Override
    public OaEmergencyContact selectByPrimaryKey(Long emergencyContactId) {
        return oaEmergencyContactMapper.selectByPrimaryKey(emergencyContactId);
    }

    /**
     * 修改或逻辑删除的操作
     * @param record 模型
     * @return 返回行数
     */
    @Override
    public int updateByPrimaryKeySelective(OaEmergencyContact record) {
        return oaEmergencyContactMapper.updateByPrimaryKeySelective(record);
    }

    /**
     * 根据流程id查询紧急联络人
     * @param entryId 流程id
     * @return 返回数据
     */
    @Override
    public List<OaEmergencyContact> selectAll(Long entryId) {
        return oaEmergencyContactMapper.selectAll(entryId);
    }

    /**
     * 根据流程id查询紧急联络人
     * @param entryId 流程id
     * @return 返回数据
     */
    @Override
    public List<OaEmergencyContact> selectAlls(Long entryId) {
        return oaEmergencyContactMapper.selectAlls(entryId);
    }
}
